angular.module('starter.getData',['starter.controllers'])

    //登录相关
    .factory('login',["$http","$rootScope", function($http,$rootScope){
        return {
            //登录接口
            // phoneCode:手机号码
            // password:密码
             log:function(phoneCode,password)
            {
                return $http.jsonp(ajaxPath+"system/StoreLogin!login?callback=JSON_CALLBACK&userName="+phoneCode+"&userPass="+password+"&t="+(new Date()).getTime())
            },
            //获取当前用户的登录状态
            isLog:function()
            {
                return $http.jsonp(ajaxPath+"system/PartnerIfLogin!ifLogin?callback=JSON_CALLBACK&t="+(new Date()).getTime());
            }                                                            
        }

    }])

    //门店数据(获取,提交)
    .factory('StoreData',['$http', function($http){
        return {
            //获取门店数据
            get:function()
            {
                return $http.jsonp(ajaxPath+"store/StoreDataList!getDataList"+"?callback=JSON_CALLBACK&t="+(new Date()).getTime());
            },
            //提交门店数据
            submit:function(a){

                return $http.jsonp(ajaxPath+"store/DayProfitSubmitData!submitData"+"?callback=JSON_CALLBACK&year="+a.year+"&month="+a.month+"&day="+a.day+"&text="+encodeURIComponent(a.text)+"&t="+(new Date()).getTime());
            }
        }
    }])